package com.oa.action;

import java.util.Set;

import com.oa.bean.work.Dept;
import com.oa.bean.work.Emp;
import com.oa.bean.work.Family;
import com.oa.service.TestService;
import com.opensymphony.xwork2.ActionSupport;

public class TestAction extends ActionSupport {

	private static final long serialVersionUID = -1761080171427264129L;
	private TestService service;

	public TestService getService() {
		return service;
	}

	public void setService(TestService service) {
		this.service = service;
	}

	@Override
	public String execute() throws Exception {
		System.out.println("----------------");
		Dept d = service.queryDept();
		System.out.println(d);
		Set<Emp> set = d.getEmps();
		if (set != null) {
			for (Emp e : set) {
				System.out.println(e);
				if (e.getFamilys() != null) {
					for (Family f : e.getFamilys())
						System.out.println(f);
				}
			}
		}
		return SUCCESS;
	}

}
